package com.woniuxy.userassembly.dao;

import com.woniuxy.userassembly.model.RbacUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Liyfi
 * @since 2021-05-22
 */
public interface RbacUserMapper extends BaseMapper<RbacUser> {

    @Insert("insert into rbac_user (username,password) value(#{username},#{password})")
    int register(RbacUser rbacuser);

    @Select("select * from rbac_user where username=#{username} and password=#{password}")
    RbacUser platformLogin(RbacUser user);

    @Update("update  rbac_user set username = #{username},password = #{password} where user_id= #{userId}")
    int updUser(RbacUser user);

    @Delete("delete from rbac_user where user_id  =#{userId}")
    int delUser(int userId);

    @Select("select * from rbac_user where username = #{username}")
    RbacUser findUserById(String username);
}
